﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NFine.Data;
using NFine.Domain._03_Entity.Biz;
using NFine.Domain._04_IRepository.Biz;

namespace NFine.Repository.Biz
{
    public class UserWithdrawalsRepository : RepositoryBase<UserWithdrawalsEntity>, IUserWithdrawalsRepository
    {
        public decimal GetSumTiXian(string uid) {
            string sql =
               string.Format(
                   "SELECT sum(F_WithdrawalsMoney) as result from  biz_user_withdrawals WHERE F_UserId = '{0}' and F_WithdrawalsStatus=1",
                   uid);
            return GetSingleToDecimal(sql);
        }

        public decimal? GetAllTixianMoney()
        {
            return GetSingleToDecimal("select SUM(F_WithdrawalsMoney) as result FROM  biz_user_withdrawals where F_WithdrawalsStatus = 1");
        }
    }
}
